#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>

int main()
{
	int sum = 0;
	int age = 1;
	for (; age < 100; age++)
	{
	 int min = pow(age, 3);
	 int max = pow(age, 4);
	 if (min > 1000&&max > 100000)
	 {
		 for (int i = 0; i < 4; i++)
		 {
			 sum+= min % 10;
			 min = min / 10;
	     }
		 for (int i = 0; i < 6; i++)
		 {
			 sum += max % 10;
			 max = max / 10;
		 }
	 }
	 if (sum == 45) {
		 printf("%d", age); break;
	 }
	}
}